#pragma once
#include <CL/opencl.h>
#include <string>
using namespace std;
class COpenCLSupport
{
public:
	COpenCLSupport(void);
	~COpenCLSupport(void);
public:
	BOOL	CreateGradientLinerBuff(IN OUT BYTE*& pBuffer, int nWidth ,int nHeight,float fTheta,TPColorValue* pColorValue,int nTableSize);
	BOOL	CreateGradientCenter(IN OUT BYTE*& pBuffer, int nWidth ,int nHeight,int nCenterX, int nCenterY, TPColorValue* pColorValue,int nTableSize);
	BOOL	CreateGradientCircle(IN OUT BYTE*& pBuffer, int nWidth ,int nHeight,float fCenterX, float fCenterY, TPColorValue* pColorValue,int nTableSize);
	BOOL	CreateGradientQuad(IN OUT BYTE*& pBuffer, int nWidth ,int nHeight,float fRadius,float* fPTX,float* fPTY, TPColorValue* pColorValue);
	BOOL	StretchBuffer(IN OUT DWORD* pBuffer, IN int nWidth ,IN int nHeight, IN DWORD* pImage, IN int nImageWidth, IN int nImageHeight,eBufferFormat eFormat /*= e8Bit*/ );
	BOOL	InitGPUPlatform();

private:
	BOOL	OpenFile(char* pFile,string& strSource);

private:
	cl_platform_id		cpPlatform;					// OpenCL ƽ̨
	cl_device_id		device_id;					// device ID
	cl_context			context;					// context
	cl_command_queue	queue;						// command queue
	
	cl_program			m_ColorLibProgram;             // program

	cl_kernel			m_LinerKernel;              // kernel
	cl_kernel			m_CenterKernel;             // kernel
	cl_kernel			m_CircleKernel;             // kernel
	cl_kernel			m_QuadKernel;             // kernel
	cl_kernel			m_StretchBuffer;			// 

	BOOL				m_bInit;
};
